public class test5 {
    public static void main(String[] args) {
        int[] arr = new int[]{8,8,8,8,8,8,5,5,3,6,626};
        int sum = find(arr);
        System.out.println(sum);
    }

    private static int find(int[] arr) {

        for (int j : arr) {
            int count = 0;//统计每个元素出现的次数
            for (int k : arr) {
                if (j == k) {
                    count++;
                }
            }
            if (count > arr.length / 2) {
                return j;
            }
        }
        return -1;
    }

}
